{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/employee-importance\n",
    "\n",
    "\n",
    "Runtime: 28 ms, faster than 93.97% of C++ online submissions for Employee Importance.\n",
    "Memory Usage: 14.2 MB, less than 73.77% of C++ online submissions for Employee Importance.\n",
    "\n",
    "\n",
    "\n",
    "```cpp\n",
    "class Solution {\n",
    "public:\n",
    "    int getImportance(vector<Employee*> employees, int id) {\n",
    "        //5:11\n",
    "        map<int, Employee*> theMap;\n",
    "        for (int i=0; i<employees.size(); i++) {\n",
    "            theMap[employees[i]->id] = employees[i];\n",
    "        }\n",
    "        queue<int> q;\n",
    "        q.push(id);\n",
    "        int importance = 0;\n",
    "        while (q.size()) {\n",
    "            int id = q.front();\n",
    "            q.pop();\n",
    "            auto person = theMap[id];\n",
    "            importance += person->importance;\n",
    "            for (int i=0; i<person->subordinates.size(); i++) {\n",
    "                q.push(person->subordinates[i]);\n",
    "            }\n",
    "        }\n",
    "        return importance;\n",
    "        //5:26\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
